package de.dhbw.horb.inf2013.vierFarbenProblem.viewModel.lineToFigure;

/**
 * The Class Point (not working).
 */
public class Point {

	/** The x. */
	private int x;

	/** The y. */
	private int y;

	private int id;

	private static int idCounter;

	/**
	 * Instantiates a new point.
	 * 
	 * @param x
	 *            the x
	 * @param y
	 *            the y
	 */
	public Point(int x, int y) {
		this.id = idCounter++;
		this.x = x;
		this.y = y;
	}

	/**
	 * Gets the x.
	 * 
	 * @return the x
	 */
	public int getX() {
		return x;
	}

	/**
	 * Gets the y.
	 * 
	 * @return the y
	 */
	public int getY() {
		return y;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	public boolean equals(Object obj) {
		Point p;

		try {
			p = ((Point) obj);
		} catch (ClassCastException e) {
			return false;
		}

		if (p.getX() == getX() && p.getY() == getY()) {
			return true;
		}
		return false;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return "X:" + x + " Y:" + y;
	}

	public int getId() {
		return id;
	}
}
